from lxml import etree

from . import path

__annotation_xslt = None

def annotation_xslt(force=False):
    global __annotation_xslt

    if __annotation_xslt is None or force:
        f = open(path.get_data_path("xml", "annotation.xsl"))
        xslt_doc = etree.parse(f)
        f.close()

        __annotation_xslt = etree.XSLT(xslt_doc)

    return __annotation_xslt
